<template>
  <div>
    <h1>axios 二次封装</h1>
    用户名：<input type="text" v-model="user_name" /><br />
    密码：<input type="text" v-model="password" /><br />
    <button @click="register">注册</button>
  </div>
</template>

<script>
import { requestGet, requestPost } from "@/untils/request.js";
export default {
  async mounted() {
    let result = await requestGet("/search_info");
    console.log(result);
  },
  data() {
    return {
      user_name: "",
      password: "",
    };
  },
  methods: {
    async register() {
      const user = {
        user_name: this.user_name,
        password: this.password,
      };
      // 目前需要做的是将user提交给服务
      /*     console.log(user);
      console.log(requestPost); */
      const result = await requestPost("/register", user);
      console.log(result);
    },
  },
};
</script>

<style lang="scss" scoped>
</style>